//
//  Target_Player.m
//  CharonTVProject
//
//  Created by karong on 2023/8/8.
//

#import "Target_Player.h"
#import "WSPlayerDetailController.h"
#import "WSChapterController.h"

@implementation Target_Player

- (id)Action_charonTV_player:(NSDictionary *)params {
    WSPlayerDetailController * targetVC = (WSPlayerDetailController *)[self instantiateViewControllerWithName:@"WSPlayerDetailController"];
    WSVideo * tvideo = [WSVideo new];
    WSVideo * video = params[@"video"];
    if (video.tv_id == 0) {
        tvideo.tv_id = video.id;
    }
    else {
        tvideo.tv_id = video.tv_id;
        tvideo.id = video.id;
    }
    targetVC.charonTV_video = tvideo;
    return targetVC;
}

- (id)Action_charonTV_chapterList:(NSDictionary *)params {
    WSChapterController * targetVC = (WSChapterController *)[self instantiateViewControllerWithName:@"WSChapterController"];
    if ([params.allKeys containsObject:@"videoDetail"])targetVC.charonTV_videoDetail = params[@"videoDetail"];
    targetVC.charonTV_video = params[@"video"];
    targetVC.charonTV_selectHandle = params[@"selectHandle"];
    return targetVC;
}

- (UIViewController *)instantiateViewControllerWithName:(NSString *)name {
   return [self instantiateViewControllerWithStoryboardNam:name identifier:name];
}

- (UIViewController *)instantiateViewControllerWithStoryboardNam:(NSString *)storyboard identifier:(NSString *)identifier{
   return [[UIStoryboard storyboardWithName:storyboard bundle:nil] instantiateViewControllerWithIdentifier:identifier];
}

@end
